<?php

class admin_template_system_app_remote_listing extends admin_theme
{


	protected function center()
	{
	    $remote_apps = $this->get('remote_apps');
	    if($remote_apps->status!='0')
	    {
	        echo $remote_apps->description;
	        return;
	    }
	    $apps = $remote_apps->apps;
	    
		$ui_listing = bone::get_admin_ui('listing');
		
		foreach($apps as $app)
		{
		    $app->create_time = date('Y年m月d日',$app->create_time);
			$app->description = limit($app->description, 80);
		}
		
		$ui_listing->set_data($apps);

		$ui_listing->set_filter(
            array(
            	'type'=>'text', 
            	'name'=>'key', 
            	'label'=>'关健字', 
            	'value'=>$remote_apps->key, 
            	'width'=>'120px'
            )
		);
		
		$ui_listing->set_fields(
			array(
    			'name'=>'thumbnail',
    			'label'=>'缩略图',
    			'align'=>'center',
    		    'width'=>'100',
    		    'template'=>'<img src="{thumbnail}" width="90">'
    		),
    		array(
    			'name'=>'name',
    			'label'=>'名称',
    			'align'=>'left',
    			'template'=>'<strong>{name}</strong><br />{description}'
    		),
            array(
    			'name'=>'create_time',
    			'label'=>'作者',
    			'align'=>'left',
    		    'width'=>'200',
    			'template'=>'<strong>{auther}</strong><br />{auther_email}<br />{auther_website}'
    		),	 
            array(
    			'name'=>'create_time',
    			'label'=>'发布时间',
    			'align'=>'center',
    		    'width'=>'120'
    		),	 
            array(
    			'name'=>'id',
    			'align'=>'center',
    		    'width'=>'120',
    			'template'=>'<input type="button" onclick="javascript:window.location.href=\'./?action=system.app.remote_detail&app_id={id}\';" value="安装">'
    		)

		);
		
		$pagination = bone::get_ui('pagination');
		$pagination->set_total($remote_apps->total);
		$pagination->set_limit($remote_apps->limit);
		$pagination->set_page($remote_apps->page);
		
		$ui_listing->set_pagination( $pagination );
		$ui_listing->display();
	}	

}
?>